package com.xiashitech.agent.instrumentation.biz.userinfo.httpsession;

import io.opentelemetry.javaagent.shaded.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.javaagent.shaded.io.opentelemetry.api.GlobalOpenTelemetry;

public class XSHttpSessionSingletons {
    private XSHttpSessionSingletons() {}
    private static final String INSTRUMENTATION_NAME = "com.xiashitech.biz.user.httpsession";
    private static final String SPAN_NAME = "xs.user-httpsession-span";
    private static final Instrumenter<SessionData, SessionData> INSTRUMENTER;
    public static Instrumenter<SessionData, SessionData> instrumenter() {
        return INSTRUMENTER;
    }

    static {
        INSTRUMENTER =
                Instrumenter.<SessionData, SessionData>builder(
                                GlobalOpenTelemetry.get(),
                                INSTRUMENTATION_NAME,
                                request -> SPAN_NAME
                        ).addAttributesExtractor(new XSHttpSessionAttributesExtractor())
                        .buildInstrumenter();
    }
}
